
<!-- Menu -->
<nav id="menu">
  <span class="stack-info otp-version">Elixir {{site.elixir.version}} - Erlang/OTP {{site.erlang.OTP}} [erts-{{site.erlang.erts}}]</span>
  <header class="major">
    <h2>{{ page.locale.menu }}</h2>
    <p>{{ locale.project.description }}</p>
  </header>
  <ul>
    <li>
      <a href="/{% if page.lang %}{{ page.lang }}/{% endif %}" class="{% unless locale.disable_transform %} up {%endunless%}{% if page.layout == "home" %}active{% endif %}">{{ site.data['locales'][language]['sections']['home'] }}</a>
    </li>
  {% for sections in site.contents[language] %}
    {% assign section = sections[0] | strip %}
    {% assign chapters = sections[1] %}
    {% if page.section %}
      {% assign visiting = page.section %}
    {% else %}
      {% assign visiting = "blog" %}
    {% endif %}
    {% if visiting == section or (visiting == "home" and section == "basics") %}
      {% assign opened = true %}
    {% else %}
      {% assign opened = false %}
    {% endif %}
    {% unless section == "home" %}
      {% for chapter in chapters %}
        {% if forloop.first %}
        <li>
          <span class="opener{% if opened %} active{% endif %}{% unless locale.disable_transform %} up{%endunless%}">{{ locale.sections[section] }}</span>
          <ul>
        {% endif %}
            <li>
              {% if page.url == chapter[1].url %}
              <span class="active">{{ chapter[1].chapter_number }}. {{ chapter[1].title }}</span>
              {% else %}
              <a href="{{ chapter[1].url }}">{{ chapter[1].chapter_number }}. {{ chapter[1].title }}</a>
              {% endif %}
            </li>
        {% if forloop.last %}
          </ul>
        </li>
        {% endif%}
      {% endfor %}
    {% endunless %}
  {% endfor %}
    <li>
      <a href="/blog/" class="{% unless locale.disable_transform %} up {%endunless%}{% if page.layout == "blog" or page.layout == "post" or page.layout == "archive" %}active{% endif %}">{{ site.data['locales'][language]['sections']['blog']}}</a>
    </li>
    {% unless language == 'en' %}
    <li>
      <a href="/{{ page.lang }}/report/" class="{% unless locale.disable_transform %} up {%endunless%}{% if page.name == "report.md" %}active{% endif %}">{{ site.data['locales'][language]['sections']['translation_report'] }}</a>
    </li>
    {% endunless %}
    <li>
      <a href="/contributors/" class="{% unless locale.disable_transform %} up {%endunless%}{% if page.name == "contributors.html" %}active{% endif %}">{{ site.data['locales'][language]['sections']['contributors'] }}</a>
    </li>
  </ul>
</nav>
